import 'package:chathouse/public/Config.dart';
import 'package:flutter/material.dart';
import 'package:chathouse/util/base_utils.dart';
import 'package:get/get.dart';

AppBar getAppBar(
    {Widget? leading,
    String? title,
    Color? titleColor,
    TextStyle? titleTextStyle,
    Function? navigationHelperBack}) {
  return AppBar(
    backgroundColor: Colors.white,
    shadowColor: Colors.transparent,
    leading: leading ??
        Icon(
          Icons.arrow_back_ios,
          size: 18.w,
          color: MyColors.gary_149149149,
        ).setOnClickListener(() {
          FocusManager.instance.primaryFocus?.unfocus();
          if (navigationHelperBack != null) {
            navigationHelperBack();
          } else {
            Get.back();
          }
        }),
    centerTitle: true,
    title: Text(
      title ?? "",
      textAlign: TextAlign.center,
      style: titleTextStyle ??
          getTextStyle(28.sp,
              color: titleColor ?? Colors.black, fontType: FontType.MID),
    ),
  );
}
